<?php 	session_start(); ?>
<?php
include_once('db_manage.php');
//echo "<br>abbbbbbbbbb";
$username = $_POST['username'];
//echo "<br>".$username;
$password = $_POST['pass1'];
//echo "<br>".$password;
$salt = substr(uniqid(rand()), -6);
$password = md5(md5($password).$salt);
 
$sql = "insert into uc_members(username,password,salt) values('".$username."','".$password."','".$salt."')";
//echo "<br>".$sql;
mysql_query($sql);

$result_id = getLastId();
while($rs=mysql_fetch_object($result_id)){
	$lastid = $rs->id;
}
$_SESSION['uid'] = $lastid;
$_SESSION['username'] = $username;

echo "<script>location.href='index.php';</script>";
?>
